# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=webslayer
pkgver=5
pkgrel=10
groups=('blackarch' 'blackarch-webapp')
pkgdesc='A tool designed for brute forcing Web Applications.'
arch=('any')
url='https://code.google.com/p/webslayer/'
license=('GPL')
depends=('python2-pycurl' 'python2-pyqt4')
makedepends=('subversion')
source=("$pkgname::svn+http://webslayer.googlecode.com/svn/trunk/")
sha512sums=('SKIP')

prepare() {
  cd $pkgname

  sed -i 's|bin/python$|bin/python2|' *.py
}

pkgver() {
  cd $pkgname

  svnversion | tr -d [A-z]
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"
  install -dm 755 "$pkgdir/usr/share/doc/$pkgname"

  cp -R --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  rm "$pkgdir/usr/share/webslayer"/{COPYING,LICENSES}

  mv "$pkgdir/usr/share/$pkgname/README" "$pkgdir/usr/share/doc/$pkgname"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec ./WebSlayer.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

